#!/bin/bash
#启用ipv6
echo "net.ipv6.conf.all.disable_ipv6 = 0" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6 = 0" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6 = 0" >> /etc/sysctl.conf
sysctl -p
#添加Ipv6通道
    #增加自启动脚本
cat > /etc/rc.d/init.d/ipv6enable<<-EOF
#!/bin/sh
#chkconfig: 2345 20 80
#description:ipv6enable
modprobe ipv6
ip tunnel add he-ipv6 mode sit remote 184.105.253.14 local 96.8.118.20 ttl 255
ip link set he-ipv6 up
ip addr add 2001:470:1f10:210::2/64 dev he-ipv6
ip route add ::/0 dev he-ipv6
ip -f inet6 addr
EOF

    #设置脚本权限
    chmod +x /etc/rc.d/init.d/ipv6enable
    chkconfig --add ipv6enable
    chkconfig ipv6enable on


#最新的google的ipv6地址：https://raw.githubusercontent.com/lennylxx/ipv6-hosts/master/hosts
#追加
cat >> /etc/hosts <<-EOF

	## Google.com
	2404:6800:4008:c00::71 google.com
	2404:6800:4008:c02::63 www.google.com

	## Google.HK
	2404:6800:4008:c04::5e google.com.hk
	2404:6800:4008:c06::c7 www.google.com.hk

	## Google Scholar
	2404:6800:4008:c06::be scholar.google.com
	2404:6800:4008:c06::be scholar.google.com.hk
	2404:6800:4008:c06::be scholar.google.com.tw
	2404:6800:4005:805::200e scholar.google.cn
EOF

systemctl restart v2ray